home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / LIB51 / STRNCMP.C < prev    next >
Text File  |  1997-01-12  |  347b  |  15 lines

  1. /*
  2. ** strncmp(s,t,n) - Compares two strings for at most n
  3. **                  characters and returns an integer
  4. **                  >0, =0, or <0 as s is >t, =t, or <t.
  5. */
  6. strncmp(s, t, n) char *s, *t; int n; {
  7.   while(n && *s==*t) {
  8.     if (*s == 0) return (0);
  9.     ++s; ++t; --n;
  10.     }
  11.   if(n) return (*s - *t);
  12.   return (0);
  13.   }
  14.  
  15.